package com.shixj.easy.spider.model;

import com.shixj.easy.spider.constant.RegexContants;
import lombok.Data;

/**
 * Created by shixj on 2018/1/16.
 * 页面解析规则
 */
@Data
public class RegexConfig {
    private String baseUrl;//域名
    private String initUrl;//起始页面
    private String novelPageRegex;//小说页面地址规则
    private String chapterPageRegex;//章节页面地址规则

    private String coverRegex = RegexContants.DEFAULT_REGEX_COVER;//封面
    private String novelNameRegex=RegexContants.DEFAULT_REGEX_NOVEL_NAME;//小说名
    private String authorRegex=RegexContants.DEFAULT_REGEX_AUTHOR;//作者
    private String novelDesprictionRegex;//小说描述
    private String novelSourceIdRegex= RegexContants.DEFAULT_REGEX_NOVEL_SOURCE_ID;//小说源id
    private String catalogRegex=RegexContants.DEFAULT_REGEX_CATALOG;//目录
    private String titleRegex=RegexContants.DEFAULT_REGEX_TITLE;//章节标题
    private String chapterDescriptionRegex=RegexContants.DEFAULT_REGEX_DESCRIPTION;//章节预览
    private String chapterSourceIdRegex= RegexContants.DEFAULT_REGEX_CHAPTER_SOURCE_ID;//章节源id
    private String contentRegex=RegexContants.DEFAULT_REGEX_CONTENT;//章节内容

    public static RegexConfig build(){
        return new RegexConfig();
    }

    public RegexConfig setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
        return this;
    }

    public RegexConfig setCatalogRegex(String catalogRegex) {
        this.catalogRegex = catalogRegex;
        return this;
    }

    public RegexConfig setInitUrl(String initUrl) {
        this.initUrl = initUrl;
        return this;
    }



    public RegexConfig setNovelPageRegex(String novelPageRegex) {
        this.novelPageRegex = novelPageRegex;
        return this;
    }


    public RegexConfig setChapterPageRegex(String chapterPageRegex) {
        this.chapterPageRegex = chapterPageRegex;
        return this;
    }


    public RegexConfig setNovelNameRegex(String novelNameRegex) {
        this.novelNameRegex = novelNameRegex;
        return this;
    }



    public RegexConfig setAuthorRegex(String authorRegex) {
        this.authorRegex = authorRegex;
        return this;
    }



    public RegexConfig setNovelDesprictionRegex(String novelDesprictionRegex) {
        this.novelDesprictionRegex = novelDesprictionRegex;
        return this;
    }



    public RegexConfig setNovelSourceIdRegex(String novelSourceIdRegex) {
        this.novelSourceIdRegex = novelSourceIdRegex;
        return this;
    }



    public RegexConfig setTitleRegex(String titleRegex) {
        this.titleRegex = titleRegex;
        return this;
    }



    public RegexConfig setChapterDescriptionRegex(String chapterDescriptionRegex) {
        this.chapterDescriptionRegex = chapterDescriptionRegex;
        return this;
    }


    public RegexConfig setChapterSourceIdRegex(String chapterSourceIdRegex) {
        this.chapterSourceIdRegex = chapterSourceIdRegex;
        return this;
    }



    public RegexConfig setContentRegex(String contentRegex) {
        this.contentRegex = contentRegex;
        return this;
    }

    public RegexConfig setCoverRegex(String coverRegex) {
        this.coverRegex = coverRegex;
        return this;
    }
}
